package tr.net.ems.httpconnection;

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class ImageDownload 
{
	private URL mUrl;
	private Bitmap mResim;
	//private static ImageDownload Download;
	
	/*private ImageDownload()
	{}
	
	public static synchronized ImageDownload getInstance()
	{
		if(Download == null)
		{
			Download = new ImageDownload();
		}
		
		return Download;
	}
	*/
	public Bitmap LoadImageFromURL(String url)
	{
		try 
		{
			mUrl = new URL(url);
			mResim = BitmapFactory.decodeStream((InputStream)mUrl.getContent());
		} 
		catch (MalformedURLException e) {e.printStackTrace();}
		catch (IOException e) {e.printStackTrace();}
		
		return mResim;
	}
}
